<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div id="header" class="wrap">
    <div id="logo"><img src="${pageContext.request.contextPath}/static/images/logo.png"/></div>
    <div class="help">
        <c:if test="${!empty sessionScope.currentUser}">
            <a href="selectdd?dd=${sessionScope.currentUser.id }">个人订单</a>
        </c:if>
        <c:if test="${!empty sessionScope.currentUser}">当前用户${sessionScope.currentUser.username }</c:if>
        <a href="${pageContext.request.contextPath}/shop" class="shopping">购物车</a>
        <c:choose>
            <c:when test="${empty sessionScope.currentUser}">
                <a href="${pageContext.request.contextPath}/login">登录</a>|<a href="${pageContext.request.contextPath}/register">注册</a>
            </c:when>
            <c:otherwise>
                <a href="${pageContext.request.contextPath}/SignOut">退出</a>
            </c:otherwise>
        </c:choose>
        <a href="SelallServlet">留言</a>
        <c:if test="${sessionScope.currentUser.status==2}"><a href="${pageContext.request.contextPath}/manage/index">去后台</a></c:if>
    </div>
    <div class="navbar">
        <ul class="clearfix">
            <li <c:if test="${empty param.pid}">class="current"</c:if>>
                <a href="${pageContext.request.contextPath}/index">首页</a>
            </li>
            <%-- 遍历顶级分类 --%>
            <c:forEach var="tc" items="${categories}">
                <li <c:if test="${param.pid eq tc.id}">class="current"</c:if>>
                    <a href="${pageContext.request.contextPath}/product/list?topCid=${tc.id}">${tc.name }</a>
                </li>
            </c:forEach>
        </ul>
    </div>
</div>
<div id="childNav">
    <div class="wrap">
        <ul class="clearfix">
            <li class="first">
                <a href="javascript:searchHot('chocolate')">巧克力</a></li>
            <li><a href="javascript:searchHot('beef')">牛肉干</a></li>
            <li><a href="javascript:searchHot('biscuit')">饼干</a></li>
            <li><a href="javascript:searchHot('dry fruit')">水果干</a></li>
            <li><a href="javascript:searchHot('shampoo')">洗发水</a></li>
            <li><a href="javascript:searchHot('toothpaste')">牙膏</a></li>
            <li><a href="javascript:searchHot('body wash')">沐浴露</a></li>
            <li><a href="javascript:searchHot('dress')">连衣裙</a></li>
            <li><a href="javascript:searchHot('T-shirt')">T恤</a></li>
            <li><a href="javascript:searchHot('jeans')">牛仔裤</a></li>
            <li class="last">
                <label><input type="text" id="selectname" value="${search_words}"/></label>
                <a href="javascript:selectname()">搜索</a>
            </li>
        </ul>
    </div>
</div>

<script type="text/javascript">
    function selectname() {
        var name = document.getElementById("selectname").value;
        location.href = 'selectProductList?name=' + name;
    }

    function searchHot(name) {
        location.href = 'selectProductList?name=' + name;
    }
</script>